//
//  FFBankcardListAddCell.m
//  LLWallet
//
//  Created by tt on 2020/9/9.
//

#import "FFBankcardListAddCell.h"

@implementation FFBankcardListAddModel

- (Class)cell {
    return FFBankcardListAddCell.class;
}

- (NSNumber *)showArrow {
    return @(false);
}

@end

@interface FFBankcardListAddCell ()

@property(nonatomic,strong) UIView *bgView;

@property(nonatomic,strong) UIImageView *addImgView;

@property(nonatomic,strong) UILabel *addLbl;

@end

@implementation FFBankcardListAddCell

+ (CGSize)sizeForModel:(WKFormItemModel *)model {
    return CGSizeMake(WKScreenWidth, 70.0f);
}

- (void)setupUI {
    [super setupUI];
    [self setBackgroundColor:[UIColor clearColor]];
    
    [self.contentView addSubview:self.bgView];
    
    [self.bgView addSubview:self.addImgView]; // 添加图标
    [self.bgView addSubview:self.addLbl]; // 添加label
}

- (UIView *)bgView {
    if(!_bgView) {
        _bgView = [[UIView alloc] init];
        [_bgView setBackgroundColor:[UIColor whiteColor]];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 8.0f;
    }
    return _bgView;
}

- (UIImageView *)addImgView {
    if(!_addImgView) {
        _addImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 18.0f, 18.0f)];
        [_addImgView setImage:[self imageName:@"add"]];
    }
    return _addImgView;
}

- (UILabel *)addLbl {
    if(!_addLbl) {
        _addLbl = [[UILabel alloc] init];
        [_addLbl setText:LLang(@"添加银行卡")];
        [_addLbl sizeToFit];
        [_addLbl setTextColor:[UIColor blackColor]];
    }
    return _addLbl;
}



- (void)refresh:(FFBankcardListAddModel *)model {
    [super refresh:model];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.bgView.lim_height = self.lim_height;
    self.bgView.lim_left = 20.0f;
    self.bgView.lim_width = self.lim_width -  self.bgView.lim_left*2;
    
    self.addImgView.lim_top = self.bgView.lim_height/2.0f - self.addImgView.lim_height/2.0f;
    self.addImgView.lim_left = 20.0f;
    
    self.addLbl.lim_left = self.addImgView.lim_right + 10.0f;
    self.addLbl.lim_top = self.bgView.lim_height/2.0f - self.addLbl.lim_height/2.0f;
    
}


-(UIImage*) imageName:(NSString*)name {
    return [[WKApp shared] loadImage:name moduleID:@"LLWallet"];
}

@end


@implementation WKBiAddressdListAddModel

- (Class)cell {
    return WKBiAddressdListAddCell.class;
}

- (NSNumber *)showArrow {
    return @(false);
}

@end

@interface WKBiAddressdListAddCell ()

@property(nonatomic,strong) UIView *bgView;

@property(nonatomic,strong) UIImageView *addImgView;

@property(nonatomic,strong) UILabel *addLbl;

@end

@implementation WKBiAddressdListAddCell

+ (CGSize)sizeForModel:(WKFormItemModel *)model {
    return CGSizeMake(WKScreenWidth, 70.0f);
}

- (void)setupUI {
    [super setupUI];
    [self setBackgroundColor:[UIColor clearColor]];
    
    [self.contentView addSubview:self.bgView];
    
    [self.bgView addSubview:self.addImgView]; // 添加图标
    [self.bgView addSubview:self.addLbl]; // 添加label
}

- (UIView *)bgView {
    if(!_bgView) {
        _bgView = [[UIView alloc] init];
        [_bgView setBackgroundColor:[UIColor whiteColor]];
        _bgView.layer.masksToBounds = YES;
        _bgView.layer.cornerRadius = 8.0f;
    }
    return _bgView;
}

- (UIImageView *)addImgView {
    if(!_addImgView) {
        _addImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 18.0f, 18.0f)];
        [_addImgView setImage:[self imageName:@"add"]];
    }
    return _addImgView;
}

- (UILabel *)addLbl {
    if(!_addLbl) {
        _addLbl = [[UILabel alloc] init];
        [_addLbl setText:LLang(@"添加地址")];
        [_addLbl sizeToFit];
        [_addLbl setTextColor:[UIColor blackColor]];
    }
    return _addLbl;
}



- (void)refresh:(FFBankcardListAddModel *)model {
    [super refresh:model];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.bgView.lim_height = self.lim_height;
    self.bgView.lim_left = 20.0f;
    self.bgView.lim_width = self.lim_width -  self.bgView.lim_left*2;
    
    self.addImgView.lim_top = self.bgView.lim_height/2.0f - self.addImgView.lim_height/2.0f;
    self.addImgView.lim_left = 20.0f;
    
    self.addLbl.lim_left = self.addImgView.lim_right + 10.0f;
    self.addLbl.lim_top = self.bgView.lim_height/2.0f - self.addLbl.lim_height/2.0f;
    
}


-(UIImage*) imageName:(NSString*)name {
    return [[WKApp shared] loadImage:name moduleID:@"LLWallet"];
}

@end
